const app = getApp();
const Controller = require('../controllers/controllers.js').controller;
Page({
  data: {
    tab:[
      {
        icon:'https://img26.gz-lodihair.com/x/x6/me_icon_wdtj.png',
        text:'我的推荐',
        url:'/pages/userRecommend/userRecommend'
      },
      {
        icon:'https://img26.gz-lodihair.com/x/x6/me_icon_wdsj.png',
        text:'我的钱包',
        url:'/pages/Me/record'
      },
      {
        icon:'https://img26.gz-lodihair.com/x/x6/me_icon_yhgn.png',
        text:'用户攻略',
        url:'/pages/Me/strategy'
      },
      {
        icon:'https://img26.gz-lodihair.com/x/x6/me_icon_gywm.png',
        text:'关于我们',
        url:'/pages/doc/doc?name=关于我们&key=key-about'
      },
      {
        icon:'https://img26.gz-lodihair.com/x/x6/me_icon_hzqt.png',
        text:'合作洽谈',
        url:'/pages/doc/doc?name=合作洽谈&key=key-cooperation'
      },
      {
        icon:'https://img26.gz-lodihair.com/x/x6/me_icon_ptkf.png',
        text:'平台客服',
        url:''
      },
    ],
    userInfo:''
  },
  onLoad: function (options) {
    if(options.parentid){
      app.globalData.parentid=options.parentid
    }
  },
  onShow: function () {
    if (!wx.getStorageSync('logintoken')) {
      app.ToLogin(true)
    }else{
      this.info()
    }
  },
  goPge(e){
    if(!wx.getStorageSync('logintoken')){
      app.goLogin()
      return
    }
    let url = e.currentTarget.dataset["url"]
    if(url)
    wx.navigateTo({ url:url});
  },
  info(){
    Controller.info().then(res=>{
      if(res.data.baseData){
        this.setData({
          userInfo:res.data.baseData
        })
      }
    })
  },
  onShareAppMessage: function (e) {
  }
})